package com.wanlian.router.ui.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;

import com.wanlian.router.R;

import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Hyu on 2018/10/23.
 * Email: fvaryu@163.com
 */
public class DeleteDialog extends Dialog {

    private OnClickListener mOnClickListener;

    public DeleteDialog(@NonNull Context context) {
        super(context, R.style.UpgradeDialog);
    }

    public void setOnClickListener(OnClickListener onClickListener) {
        mOnClickListener = onClickListener;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_delete_1);

        Window window = getWindow();
        WindowManager.LayoutParams params = window.getAttributes();
        params.gravity = Gravity.BOTTOM;
        params.width = getContext().getResources().getDisplayMetrics().widthPixels;

        window.setAttributes(params);
        ButterKnife.bind(this);
    }

    @OnClick(R.id.tv_wpa_2)
    void wpa() {
        dismiss();
        if (mOnClickListener != null) {
            mOnClickListener.click("");
        }
    }

    @OnClick(R.id.tv_none)
    void none() {
        dismiss();
    }


    public interface OnClickListener {
        void click(String a);
    }


}
